package com.newshub.app.network

import com.newshub.app.data.model.News
import com.newshub.app.data.model.NewsDetail
import com.newshub.app.data.model.VideoNews
import io.reactivex.rxjava3.core.Observable
import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query

interface ApiService {
    
    /**
     * 获取头条新闻
     */
    @GET("nc/article/headline/T1348647853363/{start}-{end}.html")
    suspend fun getHeadlineNews(
        @Path("start") start: Int,
        @Path("end") end: Int
    ): Response<Map<String, List<News>>>
    
    /**
     * 获取精选新闻
     */
    @GET("nc/article/list/T1467284926140/{start}-{end}.html")
    suspend fun getFeaturedNews(
        @Path("start") start: Int,
        @Path("end") end: Int
    ): Response<Map<String, List<News>>>
    
    /**
     * 获取娱乐新闻
     */
    @GET("nc/article/list/T1348648517839/{start}-{end}.html")
    suspend fun getEntertainmentNews(
        @Path("start") start: Int,
        @Path("end") end: Int
    ): Response<Map<String, List<News>>>
    
    /**
     * 获取体育新闻
     */
    @GET("nc/article/list/T1348649079062/{start}-{end}.html")
    suspend fun getSportsNews(
        @Path("start") start: Int,
        @Path("end") end: Int
    ): Response<Map<String, List<News>>>
    
    /**
     * 获取汽车新闻
     */
    @GET("nc/auto/list/5bmz6aG25bGx/{start}-{end}.html")
    suspend fun getAutoNews(
        @Path("start") start: Int,
        @Path("end") end: Int
    ): Response<Map<String, List<News>>>
    
    /**
     * 获取视频新闻
     */
    @GET("recommend/getChanListNews")
    suspend fun getVideoNews(
        @Query("channel") channel: String = "T1457068979049",
        @Query("size") size: Int = 20
    ): Response<Map<String, List<VideoNews>>>
    
    /**
     * 获取新闻详情
     */
    @GET("nc/article/{docid}/full.html")
    suspend fun getNewsDetail(
        @Path("docid") docid: String
    ): Response<NewsDetail>
    
    /**
     * 搜索新闻
     */
    @GET("search")
    suspend fun searchNews(
        @Query("keyword") keyword: String,
        @Query("page") page: Int = 1,
        @Query("size") size: Int = 20
    ): Response<Map<String, List<News>>>
}























